package com.summer.ioc.util;

import java.io.File;

/**
 * @author xiaoye
 * @create 2021-05-13 10:10
 */
public class FileUtil {

    public static String getClassPath()
    {
        return FileUtil.class.getClassLoader().getResource("/").getPath();
    }

    public static String getExtensionName(File file)
    {
        String name = file.getName();
        return getExtensionName(name);
    }

    public static String getExtensionName(String path) {
        return path.substring(path.lastIndexOf("."));
    }

    public static String getFileNameWithoutExtensionName(File file)
    {
        String fileName = file.getName();
        return fileName.substring(0,fileName.lastIndexOf("."));
    }
}
